<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateWaimaiShopTimeConfigTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysqlWaiMaiAll')->create('waimai_shop_time_config', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('shopId')->default(0)->comment('店铺id');
            $table->unsignedTinyInteger('timeType')->default(0)->comment('1闲时 2午市 3晚市');
            $table->time('timeStart')->default(0)->comment('时段开始时间');
            $table->time('timeEnd')->default(0)->comment('时段结束时间');

            $table->integer('createdAt')->default(0)->comment('创建时间');
            $table->integer('createdByUid')->default(0)->comment('创建人');
            $table->integer('updatedAt')->default(0)->comment('修改时间');
            $table->integer('updatedByUid')->default(0)->comment('修改人');

            $table->index(['shopId'], 'idx_shopId');
            $table->comment = '外卖店铺时间段配置';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysqlWaiMaiAll')->dropIfExists('waimai_shop_time_config');
    }
}
